<template>
  <div class="container">
    <data-view
      ref="dataView"
      propViewKey="system_dv_define"
      propViewForm="frame/data-view/config-index.vue"
      @after-load="handleReady"
      @view-ready="viewReady"
      :propPageSize="10"
      :propIsTdesign="true"
    >
    </data-view>
  </div>
</template>

<script>

export default {
  name: 'programmerDataView',
  data() {
    return {
      viewKey: '',
    }
  },
  components: {
  },
  methods: {
    //扩展按钮
    handleReady() {
      if (this.viewKey) {
        this.$refs.dataView.viewRow(this.viewKey)
        this.viewKey = ''
      }
    },
    viewReady() {
      this.$refs.dataView.ocSetShowRadioBox(false)
      this.$refs.dataView.ocSetShowCheckBox(true)
      this.$refs.dataView.showCheckbox = true
    }
  },
  watch: {
    '$route.params.viewKey': {
      immediate: true,
      handler(newVal) {
        if (!newVal) {
          return
        }
        this.$nextTick(() => {
          const wrapper = this.$newWrapper().eq('viewKey', newVal)
          this.viewKey = newVal
          this.$refs.dataView.setQueryWrapperOnce(wrapper)
        })
      }
    }
  },
  computed: {
  }
}
</script>

<style lang="scss" scoped>
  .container {
    display: flex;
    height: 100%;
    background-color: #fff;
    border: 0px solid blue;
  }
</style>
